/* dssw.t DISTRIBUTION ORDER WRITE TRIGGER                            */
/*Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                 */
/*All rights reserved worldwide.  This is an unpublished work.        */
/*V8:ConvertMode=NoConvert*/
/*********************************************************************/
/*  Program :dssw.t                                                  */
/*  Author  :Ben Holmes                                              */
/*  Date    :01/19/96                                                */
/*  !Description : dss_mstr WRITE trigger program                    */
/*          : In order to enhance this trigger to support additional */
/*          : interfaces, add a DO-END block similar to the one      */
/*          : used for the Warehousing Interface to (1) check for the*/
/*          : need to continue processing; (2) move the relevant     */
/*          : fields to an appropriate work area; and (3) call       */
/*          : one or more subprograms to continue processing.        */
/*          : This .t program should remain short, relying on        */
/*          : subprograms to perform most of the work.               */
/*********************************************************************/
/*                             MODIFY LOG                            */
/*********************************************************************/
/*Revision 8.5          Last Modified:  01/19/96 BY: BHolmes *J0FY*  */
/*Revision 8.5          Last Modified:  07/27/96 BY: fwy     *J12B*  */
/*Revision 8.5          Last Modified:  01/07/97 BY: jpm     *J1DM*  */
/*Revision 9.1          Last Modified:  08/14/00 BY: *N0KW* Jacolyn Neder */
/*                                                                   */
/*                                                                   */
/*********************************************************************/

TRIGGER PROCEDURE FOR WRITE OF DSS_MSTR OLD BUFFER OLD_DSS_MSTR.

/*J12B  if not can-find(first whl_mstr where whl_mstr.whl_act no-lock) */
/*J12B  then leave. */

    {mfdeclre.i }
    define new shared work-table wf_old_dss_mstr like dss_mstr.
    define new shared variable w-recid as recid.
    define variable w-file as character format "x(24)".
    define new shared variable w-site-loc-id like whl_mstr.whl_src_dest_id.


    /* Warehousing Interface processing */

    WI:
    do:

    /* If there is no active external warehouse that is flagged to
    receive distribution order export transactions, then do not process */
/*J12B*/    if not can-find(first whl_mstr no-lock
/*J12B*/        where whl_mstr.whl_act and whl_mstr.whl_do_exp)
/*J12B*/    then leave WI.

    /* If no pertinent fields have been changed, then do not process */
/*J12B*/    if   (old_dss_mstr.dss_nbr       = dss_mstr.dss_nbr
/*J12B*/      and old_dss_mstr.dss_shipsite  = dss_mstr.dss_shipsite
/*J12B*/      and old_dss_mstr.dss_rec_site  = dss_mstr.dss_rec_site
/*J12B*/      and old_dss_mstr.dss_created   = dss_mstr.dss_created
/*J12B*/      and old_dss_mstr.dss_shipdate  = dss_mstr.dss_shipdate
/*J12B*/      and old_dss_mstr.dss_due_date  = dss_mstr.dss_due_date
/*J12B*/      and old_dss_mstr.dss_rmks      = dss_mstr.dss_rmks
/*J12B*/      and old_dss_mstr.dss_fob       = dss_mstr.dss_fob
/*J12B*/      and old_dss_mstr.dss_shipvia   = dss_mstr.dss_shipvia
/*J12B*/      and old_dss_mstr.dss_bol       = dss_mstr.dss_bol
/*J12B*/      and old_dss_mstr.dss_fr_list   = dss_mstr.dss_fr_list
/*J12B*/      and old_dss_mstr.dss_status    = dss_mstr.dss_status
/*J12B*/      and old_dss_mstr.dss_user1     = dss_mstr.dss_user1
/*J12B*/      and old_dss_mstr.dss_user2     = dss_mstr.dss_user2
/*J12B*/      and old_dss_mstr.dss_cmtindx   = dss_mstr.dss_cmtindx)
/*J12B*/    then leave WI.

    /* Move old dss_mstr fields to work table for subsequent processing */
        assign w-recid = recid(dss_mstr).
        create wf_old_dss_mstr.
        if recid(wf_old_dss_mstr)= -1 then.
        assign
            wf_old_dss_mstr.dss_nbr       = old_dss_mstr.dss_nbr
            wf_old_dss_mstr.dss_shipsite  = old_dss_mstr.dss_shipsite
            wf_old_dss_mstr.dss_rec_site  = old_dss_mstr.dss_rec_site
            wf_old_dss_mstr.dss_created   = old_dss_mstr.dss_created
            wf_old_dss_mstr.dss_shipdate  = old_dss_mstr.dss_shipdate
            wf_old_dss_mstr.dss_due_date  = old_dss_mstr.dss_due_date
            wf_old_dss_mstr.dss_rmks      = old_dss_mstr.dss_rmks
            wf_old_dss_mstr.dss_fob       = old_dss_mstr.dss_fob
            wf_old_dss_mstr.dss_shipvia   = old_dss_mstr.dss_shipvia
            wf_old_dss_mstr.dss_bol       = old_dss_mstr.dss_bol
            wf_old_dss_mstr.dss_fr_list   = old_dss_mstr.dss_fr_list
            wf_old_dss_mstr.dss_status    = old_dss_mstr.dss_status
            wf_old_dss_mstr.dss_user1     = old_dss_mstr.dss_user1
            wf_old_dss_mstr.dss_user2     = old_dss_mstr.dss_user2
/*J12B*/        wf_old_dss_mstr.dss_cmtindx   = old_dss_mstr.dss_cmtindx
        .

    /* Call subprogram to create export transactions for warehouses */
        w-file = "widssw.p".
/*J1DM*/ /* {gprun.i ""widssw.p""} */
/*J1DM*/    {gprunmo.i &module="WI"
                       &program="widssw.p"}

/*J12B*/end. /* WI */
